package cn.ssj.controller;

import cn.ssj.entity.*;
import cn.ssj.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@EnableAutoConfiguration
@RequestMapping("/front")
public class FrontController {
    @Autowired
    private AboutService aboutService;
    @Autowired
    private ActivityService activityService;
    @Autowired
    private CarouselService carouselService;
    @Autowired
    private DynamicService dynamicService;
    @Autowired
    private EnterpriseService enterpriseService;
    @Autowired
    private MessageService messageService;
    @Autowired
    private NewsService newsService;
    @Autowired
    private ProductService productService;
    @Autowired
    private ServiceService serviceService;
    @Autowired
    private SpecialtyService specialtyService;
    @Autowired
    private StaffService staffService;
    @Autowired
    private StatisticsService statisticsService;
    private static final String USE_FLAG_NORMAL="正在使用";
    private static final String USE_FLAG_STOP="已停用";
    @RequestMapping("/queryAboutByNomal")
    public List<About> queryAboutByNomal(){
        return aboutService.queryByUseFlag(USE_FLAG_NORMAL);
    }
    @RequestMapping("/queryActivityByNomal")
    public List<Activity> queryActivityByNomal(){
        return activityService.queryByUseFlag(USE_FLAG_NORMAL);
    }
    @RequestMapping("/queryCarouselByNomal")
    @ResponseBody
    public List<Carousel> queryCarouselByNomal(){
        return carouselService.queryByUseFlag(USE_FLAG_NORMAL);
    }
    @RequestMapping("/queryDynamicByNomal")
    public List<Dynamic> queryDynamicByNomal(){
        return dynamicService.queryByUseFlag(USE_FLAG_NORMAL);
    }
    @RequestMapping("/queryEnterpriseByNomal")
    public List<Enterprise> queryEnterpriseByNomal(){
        return enterpriseService.queryByUseFlag(USE_FLAG_NORMAL);
    }
    @RequestMapping("/queryNewsByNomal")
    public List<News> queryNewsByNomal(){
        return newsService.queryByUseFlag(USE_FLAG_NORMAL);
    }
    @RequestMapping("/queryProductByNomal")
    public List<Product> queryProductByNomal(){
        return productService.queryByUseFlag(USE_FLAG_NORMAL);
    }
    @RequestMapping("/queryServiceByNomal")
    public List<Service> queryServiceByNomal(){
        return serviceService.queryByUseFlag(USE_FLAG_NORMAL);
    }
    @RequestMapping("/querySpecialtyByNomal")
    public List<Specialty> querySpecialtyByNomal(){
        return specialtyService.queryByUseFlag(USE_FLAG_NORMAL);
    }
    @RequestMapping("/queryStaffByNomal")
    public List<Staff> queryStaffByNomal(){
        return staffService.queryByUseFlag(USE_FLAG_NORMAL);
    }
    @RequestMapping("/queryStatisticsByNomal")
    public List<Statistics> queryStatisticsByNomal(){
        return statisticsService.queryByUseFlag(USE_FLAG_NORMAL);
    }
    @RequestMapping("/queryNewsById")
    public News queryNewsById(Integer id){
        return newsService.queryOne(id);
    }
}
